<?php
/**
 * 一直抓学号然后存入数据库
 *
 * Created by JetBrains PhpStorm.
 * User: yzg
 * Date: 12-7-19
 * Time: 下午6:36
 * To change this template use File | Settings | File Templates.
 */
include 'global.php';

set_time_limit(0);
ignore_user_abort(true);
$sid = 'n090801617';
$pre = 'n090';

$ch = curl_init();
for($i = 100000; $i <200000; $i ++)
{
    $sid = $pre . $i;

    curl_setopt($ch, CURLOPT_URL, 'http://jwk.njfu.edu.cn/_photo/student/' . $sid . '.JPG');
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $output = curl_exec($ch);
    $response_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);

    if ($response_code != '404')
    {
        $hashid = encrypt($sid);
        mysql_query("INSERT INTO `face_sid` VALUES ('$sid', '$hashid')");
    }
}